<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>QHttpClient - HTTP客户端库 | 作者：孟鑫</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        :root {
            --primary: #3498db;
            --primary-dark: #2980b9;
            --secondary: #2c3e50;
            --light: #ecf0f1;
            --dark: #2c3e50;
            --gray: #7f8c8d;
            --accent: #e74c3c;
            --gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
            --shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
            --radius: 8px;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        body {
            background-color: #f8f9fa;
            color: var(--dark);
            line-height: 1.6;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 20px;
        }
        
        /* 头部样式 */
        header {
            background: var(--gradient);
            color: white;
            padding: 60px 0;
            text-align: center;
            margin-bottom: 40px;
            border-radius: 0 0 20px 20px;
            box-shadow: var(--shadow);
            position: relative;
            overflow: hidden;
        }
        
        header::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="100" height="100" opacity="0.1"><path d="M20,20 L80,20 L80,80 L20,80 Z" fill="none" stroke="white" stroke-width="2"/><path d="M30,30 L70,30 L70,70 L30,70 Z" fill="none" stroke="white" stroke-width="1"/></svg>');
        }
        
        .header-content {
            max-width: 800px;
            margin: 0 auto;
            position: relative;
            z-index: 1;
        }
        
        h1 {
            font-size: 2.8rem;
            margin-bottom: 15px;
            font-weight: 700;
        }
        
        .subtitle {
            font-size: 1.3rem;
            opacity: 0.9;
            margin-bottom: 20px;
        }
        
        .author {
            display: inline-flex;
            align-items: center;
            background: rgba(255, 255, 255, 0.2);
            padding: 8px 20px;
            border-radius: 30px;
            backdrop-filter: blur(5px);
        }
        
        .author img {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            margin-right: 10px;
            border: 2px solid white;
        }
        
        /* 导航样式 */
        nav {
            background: white;
            padding: 15px 0;
            margin-bottom: 30px;
            border-radius: var(--radius);
            box-shadow: var(--shadow);
            position: sticky;
            top: 0;
            z-index: 100;
        }
        
        .nav-links {
            display: flex;
            justify-content: center;
            list-style: none;
            flex-wrap: wrap;
        }
        
        .nav-links li {
            margin: 0 15px;
        }
        
        .nav-links a {
            text-decoration: none;
            color: var(--dark);
            font-weight: 500;
            padding: 8px 0;
            position: relative;
            transition: color 0.3s;
        }
        
        .nav-links a:hover {
            color: var(--primary);
        }
        
        .nav-links a::after {
            content: '';
            position: absolute;
            bottom: 0;
            left: 0;
            width: 0;
            height: 2px;
            background: var(--primary);
            transition: width 0.3s;
        }
        
        .nav-links a:hover::after {
            width: 100%;
        }
        
        /* 主内容区域 */
        .content-grid {
            display: grid;
            grid-template-columns: 1fr 300px;
            gap: 30px;
            margin-bottom: 50px;
        }
        
        .content-main {
            background: white;
            padding: 30px;
            border-radius: var(--radius);
            box-shadow: var(--shadow);
        }
        
        .sidebar {
            display: flex;
            flex-direction: column;
            gap: 20px;
        }
        
        .sidebar-card {
            background: white;
            padding: 20px;
            border-radius: var(--radius);
            box-shadow: var(--shadow);
        }
        
        h2 {
            color: var(--secondary);
            margin: 25px 0 15px;
            padding-bottom: 10px;
            border-bottom: 2px solid var(--primary);
        }
        
        h3 {
            color: var(--primary);
            margin: 20px 0 10px;
        }
        
        p {
            margin-bottom: 15px;
        }
        
        ul, ol {
            margin-left: 20px;
            margin-bottom: 20px;
        }
        
        li {
            margin-bottom: 8px;
        }
        
        /* 特性网格 */
        .features-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin: 25px 0;
        }
        
        .feature-card {
            background: #f8f9fa;
            padding: 20px;
            border-radius: var(--radius);
            border-left: 4px solid var(--primary);
            transition: transform 0.3s;
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
        }
        
        .feature-card h4 {
            color: var(--secondary);
            margin-bottom: 10px;
            display: flex;
            align-items: center;
        }
        
        .feature-card h4 i {
            margin-right: 10px;
            color: var(--primary);
        }
        
        /* 代码样式 */
        code {
            background-color: #f1f3f4;
            padding: 2px 6px;
            border-radius: 4px;
            font-family: 'Consolas', monospace;
            font-size: 0.9em;
            color: #d35400;
        }
        
        pre {
            background: #2c3e50;
            color: #ecf0f1;
            padding: 20px;
            border-radius: var(--radius);
            overflow-x: auto;
            margin: 20px 0;
            font-size: 0.9em;
            line-height: 1.5;
        }
        
        .code-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
        }
        
        .code-lang {
            font-size: 0.9em;
            color: var(--gray);
        }
        
        /* 表格样式 */
        table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
        }
        
        th, td {
            padding: 12px 15px;
            text-align: left;
            border-bottom: 1px solid #e0e0e0;
        }
        
        th {
            background-color: #f8f9fa;
            color: var(--secondary);
        }
        
        tr:hover {
            background-color: #f8f9fa;
        }
        
        /* 页脚 */
        footer {
            background: var(--secondary);
            color: white;
            padding: 40px 0 20px;
            text-align: center;
        }
        
        .footer-content {
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            margin-bottom: 20px;
        }
        
        .footer-section {
            flex: 1;
            min-width: 200px;
            margin-bottom: 20px;
        }
        
        .footer-section h3 {
            color: white;
            margin-bottom: 15px;
        }
        
        .footer-links {
            list-style: none;
        }
        
        .footer-links li {
            margin-bottom: 8px;
        }
        
        .footer-links a {
            color: #bdc3c7;
            text-decoration: none;
            transition: color 0.3s;
        }
        
        .footer-links a:hover {
            color: white;
        }
        
        .copyright {
            padding-top: 20px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
            color: #bdc3c7;
            font-size: 0.9rem;
        }
        
        /* 作者引言样式 */
        .author-quote {
            background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
            border-left: 4px solid var(--accent);
            padding: 20px;
            margin: 20px 0;
            border-radius: var(--radius);
            position: relative;
            font-style: italic;
        }
        
        .author-quote::before {
            content: """;
            font-size: 3rem;
            color: var(--accent);
            opacity: 0.3;
            position: absolute;
            top: 10px;
            left: 10px;
            font-family: serif;
        }
        
        .quote-highlight {
            color: var(--accent);
            font-weight: bold;
            font-style: normal;
        }
        
        /* 响应式设计 */
        @media (max-width: 900px) {
            .content-grid {
                grid-template-columns: 1fr;
            }
            
            .sidebar {
                order: -1;
            }
        }
        
        @media (max-width: 600px) {
            h1 {
                font-size: 2.2rem;
            }
            
            .nav-links {
                flex-direction: column;
                align-items: center;
            }
            
            .nav-links li {
                margin: 5px 0;
            }
            
            .content-main {
                padding: 20px;
            }
        }
        
        /* 动画效果 */
        .fade-in {
            animation: fadeIn 1s;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        
        .slide-in {
            animation: slideIn 0.8s ease-out;
        }
        
        @keyframes slideIn {
            from { 
                opacity: 0;
                transform: translateY(20px);
            }
            to { 
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        /* 特殊强调样式 */
        .emphasis {
            color: var(--accent);
            font-weight: bold;
            font-size: 1.1em;
        }
        
        .inspiration-box {
            background: linear-gradient(135deg, #fff3e0 0%, #ffecb3 100%);
            border: 1px solid #ffb300;
            border-radius: var(--radius);
            padding: 20px;
            margin: 20px 0;
            position: relative;
        }
        
        .inspiration-box::before {
            content: "✨";
            position: absolute;
            top: -10px;
            left: 20px;
            font-size: 1.5rem;
            background: white;
            padding: 0 10px;
        }
    </style>
</head>
<body>
    <!-- 头部 -->
    <header class="fade-in">
        <div class="container">
            <div class="header-content">
                <h1>QHttpClient</h1>
                <p class="subtitle">基于Qt网络模块的HTTP客户端封装库</p>
                <div class="author">
                    <span>作者：孟鑫</span>
                </div>
            </div>
        </div>
    </header>
    
    <div class="container">
        <!-- 导航 -->
        <nav>
            <ul class="nav-links">
                <li><a href="#overview">概述</a></li>
                <li><a href="#features">特性</a></li>
                <li><a href="#design">设计</a></li>
                <li><a href="#usage">使用</a></li>
                <li><a href="#implementation">实现</a></li>
                <li><a href="#advantages">优势</a></li>
            </ul>
        </nav>
        
        <!-- 主内容区域 -->
        <div class="content-grid">
            <div class="content-main">
                <section id="overview" class="slide-in">
                    <h2><i class="fas fa-info-circle"></i> 概述</h2>
                    <p>QHttpClient 是一个基于 Qt 网络模块的 HTTP 客户端封装类，提供了类型安全、线程安全的 HTTP 请求接口。该类采用了现代 C++ 的模板元编程技术，简化了 HTTP 请求的发送和响应处理。</p>
                    
                    <div class="inspiration-box">
                        <p>本项目的开发<span class="emphasis">踩在巨人的肩膀上</span>，深深致敬那些为开源社区做出贡献的前行者。正是有了Qt框架和C++社区的丰富资源，才有了QHttpClient的诞生。</p>
                    </div>
                    
                    <p>该库由 <strong>孟鑫</strong> 开发，结合了现代C++的最佳实践和Qt框架的功能，为开发者提供了高效、安全的HTTP通信解决方案。</p>
                </section>
                
                <section id="features" class="slide-in">
                    <h2><i class="fas fa-star"></i> 主要特性</h2>
                    <div class="features-grid">
                        <div class="feature-card">
                            <h4><i class="fas fa-exchange-alt"></i> 多种HTTP方法</h4>
                            <p>支持GET、POST、PUT和DELETE等标准HTTP方法，完整覆盖RESTful API的主要操作。</p>
                        </div>
                        <div class="feature-card">
                            <h4><i class="fas fa-code"></i> 双重回调支持</h4>
                            <p>既支持Lambda表达式和函数对象，也支持绑定到类的成员函数，使用灵活方便。</p>
                        </div>
                        <div class="feature-card">
                            <h4><i class="fas fa-cogs"></i> 自动序列化</h4>
                            <p>基于模板特化的内容类型处理，支持自定义数据类型的自动转换。</p>
                        </div>
                        <div class="feature-card">
                            <h4><i class="fas fa-shield-alt"></i> 线程安全设计</h4>
                            <p>使用线程局部存储管理QNetworkAccessManager，避免多线程环境下的竞争条件。</p>
                        </div>
                    </div>
                </section>
                
                <section id="design" class="slide-in">
                    <h2><i class="fas fa-project-diagram"></i> 核心设计</h2>
                    
                    <h3><i class="fas fa-code-branch"></i> 线程管理机制</h3>
                    <p>QHttpClient 使用 QThreadStorage 为每个线程创建独立的 QNetworkAccessManager 实例，确保线程安全：</p>
                    
                    <div class="code-header">
                        <span class="code-lang">线程安全实现</span>
                    </div>
                    <pre><code>class QHttpClient : public QObject
{
private:
    static QThreadStorage&lt;QNetworkAccessManager*&gt; threadStorage;
    
    static QNetworkAccessManager* getNetworkAccessManager() {
        if (!threadStorage.hasLocalData()) {
            threadStorage.setLocalData(new QNetworkAccessManager());
        }
        return threadStorage.localData();
    }
};</code></pre>
                    
                    <h3><i class="fas fa-magic"></i> 模板元编程应用</h3>
                    <p>通过 QFunction_traits 和 QHttpContentType 实现类型推导和内容处理：</p>
                    
                    <div class="code-header">
                        <span class="code-lang">模板元编程示例</span>
                    </div>
                    <pre><code>template&lt;typename T&gt;
void QHttpClient::get(const QNetworkRequest &request, T callback)
{
    using traits = QFunction_traits&lt;typename std::decay&lt;T&gt;::type&gt;;
    // 自动推导回调函数参数类型
    typename traits::arg1_type data;
    // 自动进行数据序列化
    QHttpContentType&lt;typename traits::arg1_type&gt;::fromByteArray(data, reply-&gt;readAll());
}</code></pre>
                </section>
                
                <section id="usage" class="slide-in">
                    <h2><i class="fas fa-play-circle"></i> 使用方法</h2>
                    
                    <h3><i class="fas fa-terminal"></i> 1. 使用 Lambda 表达式</h3>
                    <div class="code-header">
                        <span class="code-lang">Lambda表达式示例</span>
                    </div>
                    <pre><code>QNetworkRequest request(QUrl("https://api.example.com/data"));
QtNet::QHttpClient::get(request, [](MyData data, QNetworkReply* reply) {
    if (reply-&gt;error() == QNetworkReply::NoError) {
        // 处理成功响应
        processData(data);
    } else {
        // 处理错误
        handleError(reply-&gt;errorString());
    }
});</code></pre>
                    
                    <h3><i class="fas fa-object-group"></i> 2. 使用成员函数</h3>
                    <div class="code-header">
                        <span class="code-lang">成员函数示例</span>
                    </div>
                    <pre><code>class MyClass {
public:
    void handleResponse(MyData data, QNetworkReply* reply);
};

MyClass obj;
QNetworkRequest request(QUrl("https://api.example.com/data"));
QtNet::QHttpClient::get(request, &obj, &MyClass::handleResponse);</code></pre>
                    
                    <h3><i class="fas fa-paper-plane"></i> 3. 发送数据（POST/PUT）</h3>
                    <div class="code-header">
                        <span class="code-lang">发送数据示例</span>
                    </div>
                    <pre><code>MyRequestData requestData;
requestData.setValue("example");

QNetworkRequest request(QUrl("https://api.example.com/create"));
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");

QtNet::QHttpClient::post(request, requestData, [](MyResponseData data, QNetworkReply* reply) {
    // 处理响应
});</code></pre>
                </section>
                
                <section id="implementation" class="slide-in">
                    <h2><i class="fas fa-cogs"></i> 技术实现细节</h2>
                    
                    <h3><i class="fas fa-code"></i> 回调函数类型推导</h3>
                    <p>利用 QFunction_traits 分析回调函数的签名，自动提取参数类型：</p>
                    <div class="code-header">
                        <span class="code-lang">类型推导实现</span>
                    </div>
                    <pre><code>template&lt;typename T&gt;
struct QFunction_traits;  // 主模板

// 特化处理函数指针、Lambda表达式等</code></pre>
                    
                    <h3><i class="fas fa-exchange-alt"></i> 内容序列化系统</h3>
                    <p>通过 QHttpContentType 模板实现数据与字节数组的相互转换：</p>
                    <div class="code-header">
                        <span class="code-lang">序列化系统</span>
                    </div>
                    <pre><code>template&lt;typename T&gt;
struct QHttpContentType {
    static void toByteArray(const T& data, QByteArray& bytes);
    static void fromByteArray(T& data, const QByteArray& bytes);
};</code></pre>
                    
                    <h3><i class="fas fa-exclamation-triangle"></i> 错误处理机制</h3>
                    <p>统一的网络错误处理模式：</p>
                    <ul>
                        <li>检查 QNetworkReply::error()</li>
                        <li>在错误情况下仍调用回调函数保证接口一致性</li>
                        <li>自动资源清理（reply->deleteLater()）</li>
                    </ul>
                </section>
                
                <section id="advantages" class="slide-in">
                    <h2><i class="fas fa-trophy"></i> 优势特点</h2>
                    <ol>
                        <li><strong>类型安全</strong>: 编译期类型检查，减少运行时错误</li>
                        <li><strong>代码简洁</strong>: 模板化设计减少样板代码</li>
                        <li><strong>线程安全</strong>: 每个线程独立的网络管理器</li>
                        <li><strong>扩展性强</strong>: 易于添加新的HTTP方法或序列化格式</li>
                        <li><strong>Qt集成</strong>: 完美集成到Qt的信号槽体系和事件循环中</li>
                    </ol>
                    
                    <div class="author-quote">
                        <p>在技术的道路上，<span class="quote-highlight">我们踩在巨人的肩膀上致敬前行</span>，汲取前人的智慧，开拓创新的未来。QHttpClient不仅是一个工具，更是对开源精神的致敬与传承。</p>
                    </div>
                </section>
            </div>
            
            <div class="sidebar">
                <div class="sidebar-card">
                    <h3><i class="fas fa-user"></i> 关于作者</h3>
                    <div style="display: flex; align-items: center; margin-bottom: 15px;">
                        <div style="width: 60px; height: 60px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; margin-right: 15px; color: white; font-size: 1.5rem;">
                            孟
                        </div>
                        <div>
                            <h4 style="margin: 0; color: var(--secondary);">孟鑫</h4>
                            <p style="margin: 5px 0; color: var(--primary);">软件工程师</p>
                        </div>
                    </div>
                    <div class="author-quote" style="margin: 15px 0; padding: 15px; font-size: 0.9em;">
                        <p><span class="emphasis">踩在巨人肩膀上，致敬前行</span>，致力于创建高效、易用的开发工具，为开源社区贡献一份力量。</p>
                    </div>
                </div>
                
                <div class="sidebar-card">
                    <h3><i class="fas fa-link"></i> 快速导航</h3>
                    <ul style="list-style: none; margin-left: 0;">
                        <li><a href="#overview" style="display: block; padding: 8px 0; border-bottom: 1px solid #eee; text-decoration: none; color: var(--dark);"><i class="fas fa-chevron-right" style="margin-right: 10px; color: var(--primary);"></i>概述</a></li>
                        <li><a href="#features" style="display: block; padding: 8px 0; border-bottom: 1px solid #eee; text-decoration: none; color: var(--dark);"><i class="fas fa-chevron-right" style="margin-right: 10px; color: var(--primary);"></i>主要特性</a></li>
                        <li><a href="#design" style="display: block; padding: 8px 0; border-bottom: 1px solid #eee; text-decoration: none; color: var(--dark);"><i class="fas fa-chevron-right" style="margin-right: 10px; color: var(--primary);"></i>核心设计</a></li>
                        <li><a href="#usage" style="display: block; padding: 8px 0; border-bottom: 1px solid #eee; text-decoration: none; color: var(--dark);"><i class="fas fa-chevron-right" style="margin-right: 10px; color: var(--primary);"></i>使用方法</a></li>
                        <li><a href="#implementation" style="display: block; padding: 8px 0; border-bottom: 1px solid #eee; text-decoration: none; color: var(--dark);"><i class="fas fa-chevron-right" style="margin-right: 10px; color: var(--primary);"></i>技术实现</a></li>
                        <li><a href="#advantages" style="display: block; padding: 8px 0; text-decoration: none; color: var(--dark);"><i class="fas fa-chevron-right" style="margin-right: 10px; color: var(--primary);"></i>优势特点</a></li>
                    </ul>
                </div>
                
                <div class="sidebar-card">
                    <h3><i class="fas fa-code"></i> HTTP方法参考</h3>
                    <table>
                        <tr>
                            <th>方法</th>
                            <th>用途</th>
                        </tr>
                        <tr>
                            <td>GET</td>
                            <td>获取资源</td>
                        </tr>
                        <tr>
                            <td>POST</td>
                            <td>创建资源或提交数据</td>
                        </tr>
                        <tr>
                            <td>PUT</td>
                            <td>更新资源</td>
                        </tr>
                        <tr>
                            <td>DELETE</td>
                            <td>删除资源</td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    </div>
    
    <!-- 页脚 -->
    <footer>
        <div class="container">
            <div class="footer-content">
                <div class="footer-section">
                    <h3>关于QHttpClient</h3>
                    <p>QHttpClient是一个基于Qt网络模块的HTTP客户端封装库，提供了类型安全、线程安全的HTTP请求接口。</p>
                    <p style="margin-top: 10px; font-style: italic;">踩在巨人肩膀上，致敬前行，不断创新。</p>
                </div>
                <div class="footer-section">
                    <h3>快速链接</h3>
                    <ul class="footer-links">
                        <li><a href="#overview">概述</a></li>
                        <li><a href="#features">特性</a></li>
                        <li><a href="#design">设计</a></li>
                        <li><a href="#usage">使用</a></li>
                    </ul>
                </div>
                <div class="footer-section">
                    <h3>联系作者</h3>
                    <ul class="footer-links">
                        <li><a href="#"><i class="fas fa-envelope"></i> 邮箱</a></li>
                        <li><a href="#"><i class="fab fa-github"></i> GitHub</a></li>
                    </ul>
                </div>
            </div>
            <div class="copyright">
                <p>&copy; 2023 QHttpClient技术文档 | 作者：孟鑫 | 基于Qt框架的HTTP客户端库</p>
                <p style="margin-top: 10px;">踩在巨人肩膀上，致敬前行，开拓创新</p>
            </div>
        </div>
    </footer>
    
    <script>
        // 平滑滚动到锚点
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function(e) {
                e.preventDefault();
                
                const targetId = this.getAttribute('href');
                if (targetId === '#') return;
                
                const targetElement = document.querySelector(targetId);
                if (targetElement) {
                    window.scrollTo({
                        top: targetElement.offsetTop - 80,
                        behavior: 'smooth'
                    });
                }
            });
        });
        
        // 代码块复制功能
        document.querySelectorAll('pre').forEach(pre => {
            const button = document.createElement('button');
            button.innerHTML = '<i class="far fa-copy"></i>';
            button.style.cssText = `
                background: rgba(255, 255, 255, 0.2);
                color: #bdc3c7;
                border: none;
                padding: 5px 10px;
                border-radius: 5px;
                cursor: pointer;
                font-size: 0.9em;
                transition: all 0.3s;
            `;
            
            button.addEventListener('mouseenter', function() {
                this.style.background = 'rgba(255, 255, 255, 0.3)';
                this.style.color = 'white';
            });
            
            button.addEventListener('mouseleave', function() {
                this.style.background = 'rgba(255, 255, 255, 0.2)';
                this.style.color = '#bdc3c7';
            });
            
            button.addEventListener('click', () => {
                const code = pre.querySelector('code').textContent;
                navigator.clipboard.writeText(code).then(() => {
                    button.innerHTML = '<i class="fas fa-check"></i>';
                    setTimeout(() => button.innerHTML = '<i class="far fa-copy"></i>', 2000);
                });
            });
            
            const header = pre.previousElementSibling;
            if (header && header.classList.contains('code-header')) {
                header.appendChild(button);
            }
        });
        
        // 滚动动画
        const observerOptions = {
            threshold: 0.1,
            rootMargin: '0px 0px -50px 0px'
        };
        
        const observer = new IntersectionObserver(function(entries) {
            entries.forEach(entry => {
                if (entry.isIntersecting) {
                    entry.target.style.opacity = 1;
                    entry.target.style.transform = 'translateY(0)';
                }
            });
        }, observerOptions);
        
        // 为所有章节添加动画
        document.querySelectorAll('.slide-in').forEach(section => {
            section.style.opacity = 0;
            section.style.transform = 'translateY(20px)';
            section.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
            observer.observe(section);
        });
        
        // 为特殊元素添加强调效果
        document.querySelectorAll('.emphasis').forEach(el => {
            el.style.opacity = 0;
            el.style.transition = 'opacity 0.8s ease';
            setTimeout(() => {
                el.style.opacity = 1;
            }, 1000);
        });
    </script>
</body>
</html>